/**
 * 分页函数
 */
$().ready(function() {
	/**
	 *下一页
	 */
	$("#next").on("click", function() {
		var currentValue = $('#currentValue').val();
		var allPageValue = $('#allPageValue').val()
		if (parseInt(currentValue) == parseInt(allPageValue)) {
			return;
		}
		var current = parseInt(currentValue) + 1
		if (pageFlag == 3) {
			showSupplier(current)
		} else if (pageFlag == 2) {
			showComplain(current);
		} else if (pageFlag == 1) {
			OrderListPush(current);
		}else if (pageFlag == 4) {
			showHzCustomer(current);
		}else if (pageFlag == 5) {
			OrderHzListPush(current);
		}else if (pageFlag == 6) {
			showComplain(current);
		}else if (pageFlag == 7) {
			showJGCustomer(current);
		}else if (pageFlag == 8) {
			OrderHzListPush(current);
		}else if (pageFlag == 9) {
			showComplain(current);
		}


	});

	/**
	 * 上一页
	 */
	$("#current-prev").on("click", function() {
		var currentValue = $('#currentValue').val();
		if (currentValue == 1) {
			return;
		}
		var current = parseInt(currentValue) - 1
		if (pageFlag == 3) {
			showSupplier(current)
		} else if (pageFlag == 2) {
			showComplain(current);
		} else if (pageFlag == 1) {
			OrderListPush(current);
		}else if (pageFlag == 4) {
			showHzCustomer(current);
		}else if (pageFlag == 5) {
			OrderHzListPush(current);
		}else if (pageFlag == 6) {
			showComplain(current);
		}else if (pageFlag == 7) {
			showJGCustomer(current);
		}else if (pageFlag == 8) {
			OrderHzListPush(current);
		}else if (pageFlag == 9) {
			showComplain(current);
		}
	});
	/**
	 * 跳转指定页
	 */
	$("#page-btn").on("click", function() {
		var allPage = $("#allPageValue").val();
		//console.log(allPage);
		var goPage = $("#page-go").val(); //跳转页数
		if (goPage > 0 && parseInt(goPage) <= parseInt(allPage)) {
			if (pageFlag == 3) {
				showSupplier(goPage)
			} else if (pageFlag == 2) {
				showComplain(goPage);
			} else if (pageFlag == 1) {
				OrderListPush(goPage);
			}else if (pageFlag == 4) {
				showHzCustomer(goPage);
			}else if (pageFlag == 5) {
				OrderHzListPush(goPage);
			}else if (pageFlag == 6) {
				showComplain(goPage);
			}else if (pageFlag == 7) {
				showJGCustomer(goPage);
			}else if (pageFlag == 8) {
				OrderHzListPush(goPage);
			}else if (pageFlag == 9) {
				showComplain(goPage);
			}
		} else {
			return;
		}
		//清空用户跳转页数
		$("#page-go").val("");
	});

	/**
	 * 第二个列表分页
	 */
	$("#next2").on("click", function() {
		var currentValue = $('#currentValue2').val();
		var allPageValue = $('#allPageValue2').val()
		if (parseInt(currentValue) == parseInt(allPageValue)) {
			return;
		}
		var current = parseInt(currentValue) + 1
		if (pageFlag == 3) {
			showCustomer(current)
		}else if(pageFlag == 4){
			showSupplier(current);
		}
		
	});

	$("#current-prev2").on("click", function() {
		var currentValue = $('#currentValue2').val();
		if (currentValue == 1) {
			return;
		}
		var current = parseInt(currentValue) - 1
		if (pageFlag == 3) {
			showCustomer(current)
		}else if(pageFlag == 4){
			showSupplier(current);
		}
	});
	$("#page-btn2").on("click", function() {
		var allPage = $("#allPageValue2").val();
		//console.log(allPage);
		var goPage = $("#page-go2").val(); //跳转页数
		if (goPage > 0 && parseInt(goPage) <= parseInt(allPage)) {
			if (pageFlag == 3) {
				showCustomer(goPage)
			}else if(pageFlag == 4){
				showSupplier(goPage);
			}
		} else {
			return;
		}
		//清空用户跳转页数
		$("#page-go2").val("");
	});
})
/**
 * This jQuery plugin displays pagination links inside the selected elements.
 * 
 * This plugin needs at least jQuery 1.4.2
 *
 * @author Gabriel Birke (birke *at* d-scribe *dot* de)
 * @version 2.2
 * @param {int} maxentries Number of entries to paginate
 * @param {Object} opts Several options (see README for documentation)
 * @return {Object} jQuery Object
 */

